package com.molyfun.parents.activity.signup;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.widget.ListPopupWindow;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bigkoo.pickerview.OptionsPickerView;
import com.google.gson.Gson;
import com.molyfun.parents.R;
import com.molyfun.parents.activity.common.BaseActivity;
import com.molyfun.parents.fragment.dialog.DatePickerDialogFragment;
import com.molyfun.parents.fragment.dialog.SexChooseDialogFragment;
import com.molyfun.parents.rest.bean.CityBean;
import com.molyfun.parents.rest.bean.SignUpNoticeResponse;
import com.molyfun.parents.utils.IDCardVerify;
import com.molyfun.parents.utils.JsonFileReader;
import com.molyfun.parents.utils.PreferencesStorageUtil;
import com.molyfun.parents.utils.TimeUtils;
import com.molyfun.parents.utils.VerificationInfomationUtils;

import org.json.JSONArray;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;

public class SignUpBasicInfoActivity extends BaseActivity implements View.OnClickListener {

    private String TAG = "SignUpBasicInfoActivity";
    @InjectView(R.id.base_title_left)
    ImageView mBack;
    @InjectView(R.id.base_title)
    TextView mTitle;
    @InjectView(R.id.view_student_info)
    LinearLayout mViewStudentInfo;
    @InjectView(R.id.view_parents_info)
    LinearLayout mViewParentsInfo;
    @InjectView(R.id.sex_choose)
    TextView mSexChoose;

    @InjectView(R.id.mother_sex_choose)
    TextView mMotherSexChoose;
    @InjectView(R.id.father_info_sex)
    TextView mFatherSexChoose;

    @InjectView(R.id.next_button)
    TextView mNextButton;

//    ArrayList<String> districtContryId;
//    ArrayList<List<String>> districtCountryIds;
//    ArrayList<List<List<String>>> districtCountryIdList = new ArrayList<>();

    HashMap<String, String> addressIdMap = new HashMap<>();
    private List<String> parityLists = new ArrayList<String>();
    private EditText editStudentName;
    private TextView editBornDate;
    private TextView editEmbory;
    private TextView editIdentityLocal;
    private EditText editIdentityCard;
    private EditText editReservationEmail;
    private EditText editReservationPhone;
    private EditText editReservationAddress;
    private TextView guardian1;
    private EditText editParenceMotherName;
    private EditText editParenceMotherIdentity;
    private EditText editParenceMotherRelationship;
    private TextView editParenceMotherEdute;
    private EditText editParenceMotherProfession;
    private EditText editParenceMotherQQ;
    private EditText editParenceMotherConnect;
    private TextView guardian2;
    private EditText editParenceFatherName;
    private EditText editParenceFatherIdentity;
    private EditText editParenceFatherRelationship;
    private TextView editParenceFatherEdute;
    private EditText editParenceFatherProfession;
    private EditText editParenceFatherQQ;
    private EditText editParenceFatherConnect;
    private LinearLayout layout_mother;
    private LinearLayout layout_father;
//    private SexCheckView sex_check_view;
//    private String currentSex;
    private String departid;
    private SignUpNoticeResponse.SignUpNotice signUpNoticeBean;

    private ArrayList<CityBean> options1Items = new ArrayList<>();
    private ArrayList<ArrayList<String>> options2Items = new ArrayList<>();
    private ArrayList<ArrayList<ArrayList<String>>> options3Items = new ArrayList<>();
    private ArrayList<String> educateList = null;
    private ArrayList<String> sexList = null;
    private String studentagemax;
    private String studentagemin;
    ////0:男 1:女
    private String mSexStr = "-1";
    private String mMotherSexStr = "-1";
    private String mFatherSexStr = "-1";

    public static void startActivity(Context context, SignUpNoticeResponse.SignUpNotice signUpNoticeBean) {
        Intent intent = new Intent();
        Bundle bundle = new Bundle();
        bundle.putParcelable("sign_up_notice", signUpNoticeBean);
        intent.putExtras(bundle);
        intent.setClass(context, SignUpBasicInfoActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_up_basic_info);
        ButterKnife.inject(this);
        getSupportActionBar().setTitle("");

        mTitle.setText("基本信息");
        initView();

    }

    private void initView() {
        parityLists.add("1");
        parityLists.add("2");
        parityLists.add("3");
        sexList = new ArrayList<>();
        sexList.add("男");
        sexList.add("女");
        educateList = new ArrayList<>();
        educateList.add("小学");
        educateList.add("初中");
        educateList.add("高中");
        educateList.add("中专");
        educateList.add("大专");
        educateList.add("本科");
        educateList.add("硕士");
        educateList.add("博士");
        getSupportActionBar().setTitle("");
        mBack.setOnClickListener(this);
        mNextButton.setOnClickListener(this);
        signUpNoticeBean = getIntent().getParcelableExtra("sign_up_notice");
        if (signUpNoticeBean != null) {
            departid = signUpNoticeBean.getDepartid();
            //最大时间
            studentagemax = signUpNoticeBean.getStudentagemax();
            //最小时间
            studentagemin = signUpNoticeBean.getStudentagemin();

        }
        editStudentName = (EditText) mViewStudentInfo.findViewById(R.id.student_info_name);
        //性别
//        sex_check_view = (SexCheckView) mViewStudentInfo.findViewById(R.id.sex_check_view);
        editBornDate = (TextView) mViewStudentInfo.findViewById(R.id.student_info_born_date);
        editEmbory = (TextView) mViewStudentInfo.findViewById(R.id.student_info_embory);
        editIdentityLocal = (TextView) mViewStudentInfo.findViewById(R.id.student_info_identity_local);
        editIdentityCard = (EditText) mViewStudentInfo.findViewById(R.id.student_info_identity_card);

        editReservationEmail = (EditText) mViewStudentInfo.findViewById(R.id.reservation_info_email);
        editReservationPhone = (EditText) mViewStudentInfo.findViewById(R.id.reservation_info_phone);
        editReservationAddress = (EditText) mViewStudentInfo.findViewById(R.id.reservation_info_home_address);

        layout_mother = (LinearLayout) mViewParentsInfo.findViewById(R.id.layout_mother);
        editParenceMotherName = (EditText) mViewParentsInfo.findViewById(R.id.mother_info_name);

        editParenceMotherIdentity = (EditText) mViewParentsInfo.findViewById(R.id.mother_info_identity);
        editParenceMotherRelationship = (EditText) mViewParentsInfo.findViewById(R.id.mother_info_relationship);
        editParenceMotherEdute = (TextView) mViewParentsInfo.findViewById(R.id.mother_info_edute);
        editParenceMotherProfession = (EditText) mViewParentsInfo.findViewById(R.id.mother_info_profession);
        editParenceMotherQQ = (EditText) mViewParentsInfo.findViewById(R.id.mother_info_qq);
        editParenceMotherConnect = (EditText) mViewParentsInfo.findViewById(R.id.mother_info_connect);

        layout_father = (LinearLayout) mViewParentsInfo.findViewById(R.id.layout_father);
        editParenceFatherName = (EditText) mViewParentsInfo.findViewById(R.id.father_info_name);
        editParenceFatherIdentity = (EditText) mViewParentsInfo.findViewById(R.id.father_info_identity);
        editParenceFatherRelationship = (EditText) mViewParentsInfo.findViewById(R.id.father_info_relationship);
        editParenceFatherEdute = (TextView) mViewParentsInfo.findViewById(R.id.father_info_edute);
        editParenceFatherProfession = (EditText) mViewParentsInfo.findViewById(R.id.father_info_profession);
        editParenceFatherQQ = (EditText) mViewParentsInfo.findViewById(R.id.father_info_qq);
        editParenceFatherConnect = (EditText) mViewParentsInfo.findViewById(R.id.father_info_connect);

        String email = PreferencesStorageUtil.getEmail(this);
        String phoneNum = PreferencesStorageUtil.getPhoneNum(this);
        editReservationEmail.setText(email);
        editReservationPhone.setText(phoneNum);
        editReservationPhone.setEnabled(false);

        editBornDate.setOnClickListener(this);
        editEmbory.setOnClickListener(this);
        editIdentityLocal.setOnClickListener(this);
        editParenceMotherEdute.setOnClickListener(this);
        editParenceFatherEdute.setOnClickListener(this);
        mSexChoose.setOnClickListener(this);
        mMotherSexChoose.setOnClickListener(this);
        mFatherSexChoose.setOnClickListener(this);

    }
    private String contryId = "";

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.base_title_left:
                finish();
                break;
            case R.id.student_info_born_date:
                final String currentTime = TimeUtils.longToString(System.currentTimeMillis(), "yyyy-MM-dd");
                TimeUtils.getChooseDate(SignUpBasicInfoActivity.this, new DatePickerDialogFragment.IDateCallback() {
                    @Override
                    public void onTimeChoosed(String time) {
                        String[] splitTime = time.split("-");//2015-12-26min2011-12-26
                        String[] currentSplitTime = currentTime.split("-");

                        if(TextUtils.isEmpty(studentagemax) && TextUtils.isEmpty(studentagemin)){
                            editBornDate.setText(time);
                        }else{

                            String[] maxTime = studentagemax.split("-");
                            String[] minTime = studentagemin.split("-");
                            if (Integer.valueOf(splitTime[0] + splitTime[1] + splitTime[2]) <= Integer.valueOf(currentSplitTime[0] + currentSplitTime[1] + currentSplitTime[2])) {

                                if(TextUtils.isEmpty(studentagemax) && !TextUtils.isEmpty(studentagemin)){
                                    if (Integer.valueOf(minTime[0] + minTime[1] + minTime[2]) <= Integer.valueOf(splitTime[0] + splitTime[1] + splitTime[2])){
                                        editBornDate.setText(time);
                                    } else {
                                        toast("年龄不符合该校入学要求");
                                    }


                                }else if(TextUtils.isEmpty(studentagemin) && !TextUtils.isEmpty(studentagemax)){
                                    if (Integer.valueOf(splitTime[0] + splitTime[1] + splitTime[2]) <= Integer.valueOf(maxTime[0] + maxTime[1] + maxTime[2])){
                                        editBornDate.setText(time);
                                    } else {
                                        toast("年龄不符合该校入学要求");
                                    }
                                }else{
                                    if (Integer.valueOf(minTime[0] + minTime[1] + minTime[2]) <= Integer.valueOf(splitTime[0] + splitTime[1] + splitTime[2]) && Integer.valueOf(splitTime[0] + splitTime[1] + splitTime[2]) <= Integer.valueOf(maxTime[0] + maxTime[1] + maxTime[2])) {
                                        editBornDate.setText(time);
                                    } else {
                                        toast("年龄不符合该校入学要求");
                                    }
                                }

                            } else {
                                toast("出生日期大于当前日期");
                            }
                        }

                    }
                });
                break;
            case R.id.student_info_identity_local:
                ShowPickerView();
                break;
            case R.id.student_info_embory:
                //胎次
                ListPopupWindow mListPop = new ListPopupWindow(this);
                selectorOperation(parityLists, mListPop, editEmbory);
                mListPop.show();
                break;
            case R.id.next_button:
                getInfoData();
                break;
            case R.id.mother_info_edute:
                //TODO 增加文化程度数据
                ListPopupWindow listPopupWindow = new ListPopupWindow(this);
                selectorOperation(educateList, listPopupWindow, editParenceMotherEdute);
                listPopupWindow.show();
                break;
            case R.id.father_info_edute:
                //TODO 增加文化程度数据
                ListPopupWindow fatherlistPopupWindow = new ListPopupWindow(this);
                selectorOperation(educateList, fatherlistPopupWindow, editParenceFatherEdute);
                fatherlistPopupWindow.show();
                break;
            case R.id.sex_choose:
                new SexChooseDialogFragment.SexChooseDialogBuilder()
                        .setSexChooseCallback(new SexChooseDialogFragment.SexChooseCallback() {
                            @Override
                            public void onSexChoose(boolean isMale) {
                                if(isMale){
                                    mSexStr = "男";
                                    mSexChoose.setText("男");
                                }else{
                                    mSexStr = "女";
                                    mSexChoose.setText("女");
                                }
                            }
                        })
                        .build(getSupportFragmentManager().beginTransaction());
                break;
            case R.id.mother_sex_choose:
                new SexChooseDialogFragment.SexChooseDialogBuilder()
                        .setSexChooseCallback(new SexChooseDialogFragment.SexChooseCallback() {
                            @Override
                            public void onSexChoose(boolean isMale) {
                                if(isMale){
                                    mMotherSexStr = "男";
                                    mMotherSexChoose.setText("男");
                                }else{
                                    mMotherSexStr = "女";
                                    mMotherSexChoose.setText("女");
                                }
                            }
                        })
                        .build(getSupportFragmentManager().beginTransaction());
                break;
            case R.id.father_info_sex:
                new SexChooseDialogFragment.SexChooseDialogBuilder()
                        .setSexChooseCallback(new SexChooseDialogFragment.SexChooseCallback() {
                            @Override
                            public void onSexChoose(boolean isMale) {
                                if(isMale){
                                    mFatherSexStr = "男";
                                    mFatherSexChoose.setText("男");
                                }else{
                                    mFatherSexStr = "女";
                                    mFatherSexChoose.setText("女");
                                }
                            }
                        })
                        .build(getSupportFragmentManager().beginTransaction());
                break;
        }
    }

    private void ShowPickerView() {// 弹出选择器
        showProgressDialog();
        initJsonData();
        OptionsPickerView pvOptions = new OptionsPickerView.Builder(this, new OptionsPickerView.OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int options1, int options2, int options3, View v) {
                String address = options1Items.get(options1).getPickerViewText() +
                        options2Items.get(options1).get(options2) +
                        options3Items.get(options1).get(options2).get(options3);

                if(options3Items.get(options1).get(options2) == null || options3Items.get(options1).get(options2).size() == 0){
                    contryId = addressIdMap.get(options2Items.get(options1).get(options2));
                }else{
                    contryId = addressIdMap.get(options2Items.get(options1).get(options2) + options3Items.get(options1).get(options2).get(options3));
                }

//                contryId = districtCountryIdList.get(options1).get(options2).get(options3);

                System.out.println("address--->" + address);
                System.out.println("contryId--->" + contryId);

                editIdentityLocal.setText(address);
            }
        }).setTitleText("城市选择")
                .setDividerColor(Color.BLACK)
                .setTextColorCenter(Color.BLACK) //设置选中项文字颜色
                .setContentTextSize(20)
                .build();
        pvOptions.setPicker(options1Items, options2Items, options3Items);
        pvOptions.show();
        dismissProgressDialog();
    }

    //初始化数据
    private void initJsonData() {//解析数据
        String area_json = JsonFileReader.getJson(this, "area.json");
        ArrayList<CityBean> jsonBean = parseData(area_json);//用Gson 转成实体
        options1Items = jsonBean;

        for (int i = 0; i < jsonBean.size(); i++) {
            ArrayList<String> CityList = new ArrayList<>();
            ArrayList<ArrayList<String>> Province_AreaList = new ArrayList<>();
//            districtContryId = new ArrayList<>();
//            districtCountryIds = new ArrayList<>();
            for (int c = 0; c < jsonBean.get(i).getCitylist().size(); c++) {
                String CityName = jsonBean.get(i).getCitylist().get(c).getCity();
                CityList.add(CityName);

                ArrayList<String> City_AreaList = new ArrayList<>();

                if (jsonBean.get(i).getCitylist().get(c).getCountrylist() == null
                        || jsonBean.get(i).getCitylist().get(c).getCountrylist().size() == 0) {
                    City_AreaList.add("");
                    if(!addressIdMap.containsKey(CityName)){
                        addressIdMap.put(CityName, jsonBean.get(i).getCitylist().get(c).getId());
                    }
                } else {

                    for (int d = 0; d < jsonBean.get(i).getCitylist().get(c).getCountrylist().size(); d++) {
                        String AreaName = jsonBean.get(i).getCitylist().get(c).getCountrylist().get(d).getCountry();

                        City_AreaList.add(AreaName);

                        if(!addressIdMap.containsKey(CityName + AreaName)){
                            addressIdMap.put(CityName + AreaName, jsonBean.get(i).getCitylist().get(c).getCountrylist().get(d).getId());
                        }
//                        districtContryId.add(jsonBean.get(i).getCitylist().get(c).getCountrylist().get(d).getId());
                    }
                }
                Province_AreaList.add(City_AreaList);
//                if (districtContryId != null && districtContryId.size() > 0) {
//                    districtCountryIds.add(districtContryId);
//                }
            }

            /**
             * 添加城市数据
             */
            options2Items.add(CityList);
//            districtCountryIdList.add(districtCountryIds);
            /**
             * 添加地区数据
             */
            options3Items.add(Province_AreaList);
        }

    }

    //解析Json数据 ，Gson 解析
    public ArrayList<CityBean> parseData(String result) {
        ArrayList<CityBean> detail = new ArrayList<>();
        try {
            JSONArray data = new JSONArray(result);
            Gson gson = new Gson();
            for (int i = 0; i < data.length(); i++) {
                CityBean entity = gson.fromJson(data.optJSONObject(i).toString(), CityBean.class);
                detail.add(entity);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return detail;
    }

    private void getInfoData() {
        String studentName = editStudentName.getText().toString();
//        currentSex = sex_check_view.getCurrentSexText();
        String studentBornDate = editBornDate.getText().toString().trim();
        String studentEmboryNum = editEmbory.getText().toString().trim();
        String studentIdentityLocal = editIdentityLocal.getText().toString().trim();
        String studentIdentityCard = editIdentityCard.getText().toString().trim();

        String reservationEmail = editReservationEmail.getText().toString().trim();
        String resevationPhone = editReservationPhone.getText().toString().trim();
        String reservationAddress = editReservationAddress.getText().toString().trim();

        String motherName = editParenceMotherName.getText().toString().trim();
        String motherIdentity = editParenceMotherIdentity.getText().toString().trim();
        String motherRelationship = editParenceMotherRelationship.getText().toString().trim();
        String motherEdute = editParenceMotherEdute.getText().toString().trim();
        String motherProfession = editParenceMotherProfession.getText().toString().trim();
        String motherQQ = editParenceMotherQQ.getText().toString().trim();
        String motherConnect = editParenceMotherConnect.getText().toString().trim();

        String fatherName = editParenceFatherName.getText().toString().trim();
//        String fatherSex = editParenceFatherSex.getText().toString().trim();
        String fatherIdentity = editParenceFatherIdentity.getText().toString().trim();
        String fatherRelationship = editParenceFatherRelationship.getText().toString().trim();
        String fatherEdute = editParenceFatherEdute.getText().toString().trim();
        String fatherPression = editParenceFatherProfession.getText().toString().trim();
        String fatherQQ = editParenceFatherQQ.getText().toString().trim();
        String fatherConnect = editParenceFatherConnect.getText().toString().trim();

        if(motherEdute.equals("请选择")){
            motherEdute = "";
        }
        if(fatherEdute.equals("请选择")){
            fatherEdute = "";
        }


        //判断学生信息和预留项
        if (TextUtils.isEmpty(studentName) || TextUtils.isEmpty(studentBornDate) || mSexStr.equals("-1")
                || TextUtils.isEmpty(studentEmboryNum) || TextUtils.isEmpty(studentIdentityLocal)
                || TextUtils.isEmpty(reservationEmail) || TextUtils.isEmpty(resevationPhone)
                || TextUtils.isEmpty(reservationAddress)) {
            toast("必填项和必选项必须完成");
            return;
        }
        if (!TextUtils.isEmpty(studentIdentityCard)) {
            if (!IDCardVerify.verifyIdNumber(studentIdentityCard)){
                toast("学生身份证有误");
                return;
            }

        }
        if (!VerificationInfomationUtils.isEmail(reservationEmail)) {
            toast("预留邮箱有误");
            return;
        }
        if (!VerificationInfomationUtils.isMobileNO(resevationPhone)) {
            toast("预留电话有误");
            return;
        }

        boolean isHasParents = false;

        if ((!TextUtils.isEmpty(motherName) && !mMotherSexStr.equals("-1") && !TextUtils.isEmpty(motherIdentity)
                && !TextUtils.isEmpty(motherRelationship)
                && !TextUtils.isEmpty(motherEdute) && !TextUtils.isEmpty(motherProfession)
                && !TextUtils.isEmpty(motherQQ) && !TextUtils.isEmpty(motherConnect))){

            if(!IDCardVerify.verifyIdNumber(motherIdentity)){
                toast("监护人信息身份证有误");
                return;
            }
            if(!VerificationInfomationUtils.isMobileNO(motherConnect)){
                toast("监护人电话号码有误");
                return;
            }

            isHasParents = true;
        }else{
            if(!((TextUtils.isEmpty(motherName) && mMotherSexStr.equals("-1") && TextUtils.isEmpty(motherIdentity)
                    && TextUtils.isEmpty(motherRelationship)
                    && TextUtils.isEmpty(motherEdute) && TextUtils.isEmpty(motherProfession)
                    && TextUtils.isEmpty(motherQQ) && TextUtils.isEmpty(motherConnect)))){
                if(TextUtils.isEmpty(motherName)){
                    toast("监护人姓名不能为空");
                    return;
                }
                if(mMotherSexStr.equals("-1")){
                    toast("监护人性别必选");
                    return;
                }
                if(TextUtils.isEmpty(motherIdentity)){
                    toast("监护人信息身份证有误");
                    return;
                }
                if(TextUtils.isEmpty(motherRelationship)){
                    toast("监护人与学生关系必填");
                    return;
                }
                if(TextUtils.isEmpty(motherEdute)){
                    toast("监护人学历必选");
                    return;
                }
                if(TextUtils.isEmpty(motherProfession)){
                    toast("监护人职业必填");
                    return;
                }
                if(TextUtils.isEmpty(motherQQ)){
                    toast("监护人QQ必填");
                    return;
                }
                if(TextUtils.isEmpty(motherConnect)){
                    toast("监护人联系电话必填");
                    return;
                }

            }
        }

        if(!mFatherSexStr.equals("-1")&& !TextUtils.isEmpty(fatherIdentity)
                && !TextUtils.isEmpty(fatherRelationship)
                && !TextUtils.isEmpty(fatherEdute) && !TextUtils.isEmpty(fatherPression)
                && !TextUtils.isEmpty(fatherQQ) && !TextUtils.isEmpty(fatherConnect)) {
            if(!IDCardVerify.verifyIdNumber(fatherIdentity)){
                toast("监护人信息身份证有误");
                return;
            }
            if(!VerificationInfomationUtils.isMobileNO(fatherConnect)){
                toast("监护人电话号码有误");
                return;
            }
            isHasParents = true;
        }else{
            if(!((TextUtils.isEmpty(fatherName) && mFatherSexStr.equals("-1") && TextUtils.isEmpty(fatherIdentity)
                    && TextUtils.isEmpty(fatherRelationship)
                    && TextUtils.isEmpty(fatherEdute) && TextUtils.isEmpty(fatherPression)
                    && TextUtils.isEmpty(fatherQQ) && TextUtils.isEmpty(fatherConnect)))){
                if(TextUtils.isEmpty(fatherName)){
                    toast("监护人姓名不能为空");
                    return;
                }
                if(mFatherSexStr.equals("-1")){
                    toast("监护人性别必选");
                    return;
                }
                if(TextUtils.isEmpty(fatherIdentity)){
                    toast("监护人信息身份证有误");
                    return;
                }
                if(TextUtils.isEmpty(fatherRelationship)){
                    toast("监护人与学生关系必填");
                    return;
                }
                if(TextUtils.isEmpty(fatherEdute)){
                    toast("监护人学历必选");
                    return;
                }
                if(TextUtils.isEmpty(fatherPression)){
                    toast("监护人职业必填");
                    return;
                }
                if(TextUtils.isEmpty(fatherQQ)){
                    toast("监护人QQ必填");
                    return;
                }
                if(TextUtils.isEmpty(fatherConnect)){
                    toast("监护人联系电话必填");
                    return;
                }
            }
        }

        if(!isHasParents){
            toast("监护人信息必须完整填写一个");
            return;
        }

        SignUpEvalucateSheetActivity.startActivity(this, departid, studentName, mSexStr, studentBornDate, studentEmboryNum,
                contryId, studentIdentityCard,
                reservationEmail, resevationPhone, reservationAddress,
                motherName, mMotherSexStr, motherIdentity, motherRelationship, motherEdute, motherProfession, motherQQ, motherConnect,
                fatherName, mFatherSexStr, fatherIdentity, fatherRelationship, fatherEdute, fatherPression, fatherQQ, fatherConnect);

    }


    private void selectorOperation(final List<String> list, final ListPopupWindow popupWindow, final TextView tv_view) {
        popupWindow.setAdapter(new ArrayAdapter<String>(this, R.layout.layout_parity_pop, list));
        popupWindow.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT);
        popupWindow.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
        popupWindow.setAnchorView(tv_view);//设置ListPopupWindow的锚点，即关联PopupWindow的显示位置和这个锚点
        popupWindow.setModal(true);//设置是否是模式
        popupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                                    int position, long id) {
                tv_view.setText(list.get(position));
                popupWindow.dismiss();
            }
        });
    }
}

